package com.yazi.mxz.job.common;

import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class MySetting {
	private static Logger log = LoggerFactory.getLogger(MySetting.class);
	private static Properties preperties;
	
	static {
		reset();
	}
	
	public static void reset() {
		preperties = new Properties();
		try {
			preperties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("setting.properties"));
		} catch (IOException e) {
			log.error("找不到配置文件[classpath:setting.properties]");
		}
	}
	
	public static String getProperty(String key) {
		return String.valueOf(preperties.get(key));
	}
	
	public static boolean getMailSwitch() {
		return getProperty("st.mail.switch").equals("on") ? true: false;
	}
	
	public static String getMailHost() {
		return getProperty("st.mail.host");
	}
	
	public static String getMailName() {
		return getProperty("st.mail.name");
	}
	
	public static String getMailAddress() {
		return getProperty("st.mail.address");
	}
	
	public static String getMailPwd() {
		return getProperty("st.mail.pwd");
	}
	
	public static int getMailError() {
		return Integer.parseInt(getProperty("st.mail.error"));
	}
	
	public static long getMailIndate() {
		return Long.parseLong(getProperty("st.mail.indate"));
	}
	
	public static boolean getSmsSwitch() {
		return getProperty("st.sms.switch").equals("on") ? true: false;
	}
	
	public static int getSmsError() {
		return Integer.parseInt(getProperty("st.sms.error"));
	}
	
	public static long getSmsIndate() {
		return Long.parseLong(getProperty("st.sms.indate"));
	}
	
	public static String getSmsWeimiHost() {
		return getProperty("st.sms.weimi.host");
	}
	
	public static String getSmsWeimiUid() {
		return getProperty("st.sms.weimi.uid");
	}
	
	public static String getSmsWeimiPas() {
		return getProperty("st.sms.weimi.pas");
	}
	
	public static String getSmsWeimiCids() {
		return getProperty("st.sms.weimi.cids");
	}
	
}
